package common

import (
	"demo/util"
	"github.com/go-redis/redis"
	"github.com/spf13/viper"
)

func newClient() *redis.Client {

	util.InitConfig()

	addr := viper.GetString("redis.addr")
	password := viper.GetString("redis.password")
	db := viper.GetInt("redis.db")

	client := redis.NewClient(&redis.Options{
		Addr:     addr,     // redis地址
		Password: password, // 密码
		DB:       db,       // 使用默认数据库
	})
	return client
}
